package com.lyn.pluginapi.factory

import com.lyn.pluginapi.api.PluginApi
import java.util.concurrent.ConcurrentHashMap

/**
 * @author longyn 2025/7/4
 * @version 1.0.0
 */
class PluginFactory {

    companion object {
        val instance by lazy { PluginFactory() }
    }

    private val pluginApiMap: MutableMap<String, PluginApi> = ConcurrentHashMap()

    fun put(pluginId: String, pluginApi: PluginApi) {
        pluginApiMap[pluginId] = pluginApi
    }


    fun get(pluginId: String): PluginApi? {
        return pluginApiMap[pluginId]
    }

    fun remove(pluginId: String) {
        pluginApiMap.remove(pluginId)
    }
}